package @{package};

import com.yonyou.uap.um.application.ApplicationContext;
import com.yonyou.uap.um.base.*;
import com.yonyou.uap.um.common.*;
import com.yonyou.uap.um.third.*;
import com.yonyou.uap.um.control.*;
import com.yonyou.uap.um.core.*;
import com.yonyou.uap.um.binder.*;
import com.yonyou.uap.um.runtime.*;
import com.yonyou.uap.um.lexer.*;
import com.yonyou.uap.um.widget.*;
import com.yonyou.uap.um.widget.UmpSlidingLayout.SlidingViewType;
import com.yonyou.uap.um.log.ULog;
import java.util.*;
import android.os.*;
import android.view.*;
import android.widget.*;
import android.webkit.*;
import android.content.*;
import android.graphics.*;
import android.widget.ImageView.ScaleType;

public abstract class @{name}Activity extends UMWindowActivity {

	@{vars}
	
	@{ids}
	
	
	@Override
	public String getControllerName() {
		return "@{controller}";
	}
	
	@Override
	public String getContextName() {
		return "@{context}";
	}

	@Override
	public String getNameSpace() {
		return "@{namespace}";
	}

	protected void onCreate(Bundle savedInstanceState) {
		ULog.logLC("onCreate", this);
		super.onCreate(savedInstanceState);
        onInit(savedInstanceState);
        @{windowevents}
	}
	
	@Override
	protected void onStart() {
		ULog.logLC("onStart", this);
		@{onstart}
		super.onStart();
	}

	@Override
	protected void onRestart() {
		ULog.logLC("onRestart", this);
		@{onrestart}
		super.onRestart();
	}

	@Override
	protected void onResume() {
		ULog.logLC("onResume", this);
		@{onresume}
		super.onResume();
	}

	@Override
	protected void onPause() {
		ULog.logLC("onPause", this);
		@{onpause}
		super.onPause();
	}

	@Override
	protected void onStop() {
		ULog.logLC("onStop", this);
		@{onstop}
		super.onStop();
	}

	@Override
	protected void onDestroy() {
		ULog.logLC("onDestroy", this);
		@{ondestroy}
		super.onDestroy();
	}
	
	public  void onInit(Bundle savedInstanceState) {
		ULog.logLC("onInit", this);
		UMActivity context = this;
		UMDslConfigure configure = new UMDslConfigure();
		registerControl();
		this.getContainer();
		
		/*
		 new Thread() {
			 public void run() {
				 UMPDebugClient.startServer();
			 }
		 }.start();
		*/
		String sys_debug = ApplicationContext.getCurrent(this).getValue("sys_debug");
		if (sys_debug != null && sys_debug.equalsIgnoreCase("true")) {
			UMPDebugClient.waitForDebug();
		}

		IBinderGroup binderGroup = this;
		@{init}
		
	}
	
	private void registerControl() {
		@{idmap}
	}
	
	public void onLoad() {
		ULog.logLC("onLoad", this);
		if(currentPage!=null) {
			currentPage.onLoad();
		}
	
		@{onload}
	}
	
	public void onDatabinding() {
		ULog.logLC("onDatabinding", this);
		super.onDatabinding();
		@{databinding}
	}
	
	@Override
	public void onReturn(String methodName, Object returnValue) {
		@{return}
	}

	@Override
	public void onAfterInit() {
		ULog.logLC("onAfterInit", this);
		@{afterinit}
		onLoad();
	}
	
		@Override
	public Map<String,String> getPlugout(String id) {
		XJSON from = this.getUMContext();
		Map<String,String> r = super.getPlugout(id);
		@{plugout}
		return r;	
	}
	
	@{methods}
	
	@{getview}
	
	@{actions}

}
